package com.mos.support.enumeration;

/**
 * Package Name: com.mos.support.enumeration
 * User: grq
 * Date: 2016/4/6
 * Time: 17:24
 * Description:some des here!
 */
public enum AccessoryType {

    SYSTEM("1","系统自带"),
    CUSTOM_DEFINE("2","自定义");

    private String code;
    private String name;

    private AccessoryType(String code,String name){
        this.code = code;
        this.name = name;
    }

    // 普通方法
    public  static String getName(String code) {
        for (AccessoryType o : AccessoryType.values()) {
            if (o.getCode() .equals(code)) {
                return o.name;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static void main(String[] args) {
        System.out.println(AccessoryType.getName("1"));
    }
}
